<div class="uplfile">
    <?php
    $_SESSION['views'] = 0;

    $this->widget('ext.xupload.XUploadWidget', array(
        'url' => Yii::app()->createUrl("business/uploadimg", array("parent_id" => 1, "id" => $model->id,)),
        'model' => $model,
        'attribute' => 'file',
        'options' => array(
            'parseResponse' => 'js:function (xhr) { 
            
            $(".uplfile").dialog("close");
            location.reload();
            }',
            'beforeSend' => 'js:function (event, files, index, xhr, handler, callBack) {
         $(".uplfile").dialog("option","title","Upload image").dialog("open");
         
         handler.uploadRow.find(".file_upload_start button").click(callBack);
       
	 }'
        ),
    ));
    ?>

</div>
<div class="dialg"></div>
<button id="start_uploads" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary" style="display:none;">
    <span class="ui-button-icon-primary ui-icon ui-icon-circle-arrow-e"></span>

    <span class="ui-button-text">Start Uploads</span>
</button>



<script type="text/javascript">

    $(document).ready(function(){
        $('.uplfile').dialog({
            autoOpen:false,
            height: 140,
            modal: true,
            width:'auto',
            height:'auto'
            
            
        });
          
        $('.btcancel').live('click',function(){
            $('.uplfile').dialog('close',function(){
                
             $('.uplfile').empty();
        });  
        });
          
        $('#thumb1').bind('click', function() {
            
            $("#Business_file").click();
            $.get('../sesschange', { id: 1 });
        }) ;
        
  
        $('#thumb2').click( function() {
           
            $("#Business_file").trigger('click')
            $.get('../sesschange', { id: 2 });
        }) ;
        $('#thumb3').bind('click', function() {
            $("#Business_file").trigger('click');
            $.get('../sesschange', { id: 3 });
        }) ;
        $('#thumb4').bind('click', function() {
            $("#Business_file").trigger('click');
            $.get('../sesschange', { id: 4 });
        }) ;
        $('#thumb5').bind('click', function() {
            $("#Business_file").trigger('click');
            $.get('../sesschange', { id: 5 });
        }) ;
       
    }) ;
    $('#start_uploads').click(function () {
     
        $('.file_upload_start button').click();
        
    });
    
</script>

<p class="alert alert-info rightcontent"><i class="icon-info-sign"></i><?php echo Yii::t('content','Click imagem a alterar')?></p>
<div id="sff1">

<?php echo CHtml::form('imgs', 'post', array('enctype' => 'multipart/form-data')); ?>
    <table class="fotoup">
        <tr>
            <td id="Foto1" valign="top"><br>
                <img id="thumb1" class="imgresult img-polaroid" src="<?php echo (Yii::app()->baseUrl . '/uploads' . $model->img1); ?>"/>

            </td>
            <td id="Foto2" valign="top"><br>
                <img id="thumb2" class="imgresult img-polaroid" src="<?php echo (Yii::app()->baseUrl . '/uploads' . $model->img2); ?>"/><br>

            </td>
        </tr>

            <tr>
                <td id="Foto3" valign="top"><br>
                    <img id="thumb3" class="imgresult img-polaroid" src='<?php echo (Yii::app()->baseUrl . '/uploads' . $model->img3); ?>'><br>

                </td>
                <td id="Foto4" valign="top"><br>
                    <img id="thumb4" class="imgresult img-polaroid" src='<?php echo (Yii::app()->baseUrl . '/uploads' . $model->img4); ?>'><br>

                </td>
            </tr>
            <tr>
                <td id="Foto5" valign="top"><br>
                    <img id="thumb5" class="imgresult img-polaroid" src='<?php echo (Yii::app()->baseUrl . '/uploads' . $model->img5); ?>'><br>

                </td>
               

    </table>



<?php echo CHtml::endForm(); ?>
</div>




<script  type="text/javascript">
 
    $(document).ready(function() {
        
    
 
        $(".but").button();
      
        $('#iniciomanman').datepicker({ numberOfMonths: [1, 2], stepMonths: 2,showOtherMonths: false, firstDay: 1,changeFirstDay: false,showButtonPanel: true, dateFormat: 'yy/mm/dd' });
        $('#fimmanman').datepicker({ numberOfMonths: [1, 2], stepMonths: 2,showOtherMonths: false, firstDay: 1,changeFirstDay: false,showButtonPanel: true, dateFormat: 'yy/mm/dd' });

	
    });

</script>
